package com.qianyu.project.mapper.provider.wh;

import com.qianyu.project.mapper.provider.QualithProvider;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@Repository
public interface QualityDao {

    @SelectProvider(type = QualithProvider.class,method = "GetList")
    List<Map<String, Object>> GetList(@RequestParam Map<String,Object> m);

    @Delete("delete from project_info where id=#{value}")
    void del(String personnel);

    @Select("select id,name from emp")
    List<Map<String, Object>> getUser();

    @Select("select id,project_name from project_info")
    List<Map<String, Object>> getname();

    @Insert("insert into quality_inspect values(#{id},#{p_id},#{check_part},#{qualityer_id},#{check_situation},#{corretive_preventive_measure},#{comment}" +
            ",#{attach_ids},#{time1},#{update_user})")
    void add(Map<String, Object> m);

    @Select("select max(id) from quality_inspect where id like '%${value}%' ")
    String getDate(String date1);

    @SelectProvider(type = QualithProvider.class,method = "getAbarbeitung")
    List<Map<String, Object>> getAbarbeitung(Map<String, Object> m);

    @Delete("delete from quality_rectification where id=#{value}")
    void delete(String personnel);

    @Select("select update_user from quality_rectification")
    List<Map<String, Object>> getUserName();

    @Insert("insert into quality_rectification values(#{id},#{p_id},1,#{rect_part},#{update_user},#{quality_issue},#{rectification_content}" +
            ",#{attach_ids1},#{check_date1},#{update_user1},#{assign_date1},#{ask_done_date1},#{time1},#{rectification_feedback},'未审批')")
    void add2(Map<String, Object> m);

    @Select("select max(id) from quality_rectification")
    String getDate1(String date1);
}
